package com.aaa.ddd.controller;

import com.aaa.ddd.service.DeptService;
import com.aaa.pojo.Dept;
import com.aaa.pojo.Page;
import com.aaa.pojo.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;

@Controller
@RequestMapping("/dept")
@ResponseBody
public class DeptController {
    @Autowired
    private DeptService deptService;
    @RequestMapping("/findAll")
    public ResultBean findAll(Page page, Dept dept){
        return deptService.findAll(page,dept);
    }
@RequestMapping("/deletept")
    public Integer deletept(Integer dept_id){
        return  deptService.deletept(dept_id);
}
@RequestMapping("/updatept")
    public  int updatept(Dept dept){
        dept.setUpdate_time(new Date());
        return deptService.updarept(dept);
}
@RequestMapping("/savept")
    public  int savept(Dept dept){
        dept.setCreate_time(new Date());
        return  deptService.savept(dept);
}
@RequestMapping("/deletespt")
    public int deletespt(@RequestParam int[] dept_id){
        return deptService.deletespt(dept_id);
}

}
